import { url } from "./config.js"

$(document).ready(function(){
    async function load(){
        let res = await axios(url+"/test.json")
        let data = res.data;
        console.log(data);
        render(data);
    }
    function render(data){
        let str= ""
        data.forEach((item ,index)=>{
            str +=`
                <li data-index="${index}">${item}</li>
            `
        })
        $("#ul1").append(str);
        $("#ul1").find("li").on("click",function(){
            let index = $(this).attr("data-index")
            let insertStr = `<div style="width:100px ; height:100px ;background-color : red;">${index}</div>`;
            $(this).append(insertStr);
        })
    }
    load();
});